package ontime

import org.apache.flink.streaming.api.scala._

/**
  * @author dinghao 
  * @create 2021-08-25 15:03 
  * @message
  */
object Backflink {
  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val data:DataStream[String] = env.readTextFile(args(0))
    val value = data.flatMap(_.split(" "))
      .map((_,1))
      .keyBy(_._1)
      .reduce((s1, s2) => {
        Thread.sleep(10000L)
        (s1._1, s1._2 + s2._2)
      }).print()
    env.execute("backflink")
  }
}
